package com.cgsd.heyu.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @author xiaoxing
 * Description 说明
 * CreateData: 2020/11/9
 */
public class BitmapUtil {
    /**
     * 加载本地图片
     * @param file
     * @return
     */
    public static Bitmap getLocalBitmap(File file) {
        if (!file.exists()){
            return null;
        }
        try {
            FileInputStream fis = new FileInputStream(file);
            return BitmapFactory.decodeStream(fis);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }
}
